package huoye.shops.huoye.operation.widget;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.codeideology.android.widget.ios.dialog.base.BaseDialog;

import huoye.shops.R;
import huoye.shops.base.BaseCustomDialog;


/**
 * Created by uesr on 2018/8/11.
 */

public class HintTitleDialog extends BaseDialog<HintTitleDialog > {



    private Context mContext;
    private TextView tvTitle;
    private TextView tvContent;
    private TextView tvLeft;
    private TextView tvRight;


    public HintTitleDialog(Context context) {
        super(context);
        this.mContext = context;
    }

    @Override
    public View onCreateView() {
        widthScale(0.75f);
        View inflate = View.inflate(context, R.layout.dialog_hint_title, null);
       tvTitle = (TextView) inflate.findViewById(R.id.dialog_hint_title_tv_title);
        tvContent = (TextView) inflate.findViewById(R.id.dialog_hint_title_tv_content);
        tvLeft = (TextView) inflate.findViewById(R.id.dialog_hint_title_tv_left);
        tvRight = (TextView) inflate.findViewById(R.id.dialog_hint_title_tv_right);

        return inflate;
    }

    @Override
    public void setUiBeforShow() {
       tvLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onLeftClick();
                dismiss();
            }
        });
        tvRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onRightClick();
                dismiss();
            }
        });
    }

/*
    @Override
    public int layoutResID() {
        return R.layout.dialog_hint_title;
    }

    @Override
    public void initUI() {


        tvTitle = (TextView) findViewById(R.id.dialog_hint_title_tv_title);
        tvContent = (TextView) findViewById(R.id.dialog_hint_title_tv_content);
        tvLeft = (TextView) findViewById(R.id.dialog_hint_title_tv_left);
        tvRight = (TextView) findViewById(R.id.dialog_hint_title_tv_right);


        tvLeft.setOnClickListener(this);
        tvRight.setOnClickListener(this);
    }
*/




/*
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.dialog_hint_title_tv_left:
                listener.onLeftClick();
                dismiss();
                break;
            case R.id.dialog_hint_title_tv_right:
                listener.onRightClick();
                dismiss();
                break;
        }
    }
*/

    public void setDialogContent(String title,String content,String leftTv,String rightTv){
        tvTitle.setText(title);
        tvContent.setText(content);
        tvLeft.setText(leftTv);
        tvRight.setText(rightTv);
    }

    public interface OnHintTitleListener {
        void onLeftClick();
        void onRightClick();
    }
    public void setOnHintTitleListener(OnHintTitleListener onListener) {
        this.listener = onListener;
    }

    private OnHintTitleListener listener;

}
